package com.qk.common.enums;

import com.qk.common.constants.AvatarMessageConstants;

public enum AvatarStatus {
    ACTIVE(0, AvatarMessageConstants.AVATAR_STATUS_ACTIVE),
    GARBAGE(1, AvatarMessageConstants.AVATAR_STATUS_GARBAGE);
    
    private final int code;
    private final String description;
    
    AvatarStatus(int code, String description) {
        this.code = code;
        this.description = description;
    }
    
    public int getCode() {
        return code;
    }
    
    public String getDescription() {
        return description;
    }
    
    public static AvatarStatus fromCode(int code) {
        for (AvatarStatus status : values()) {
            if (status.code == code) {
                return status;
            }
        }
        throw new IllegalArgumentException(AvatarMessageConstants.UNKNOWN_AVATAR_STATUS_CODE + ": " + code);
    }
}